package com.yiwyn.ood.isp;

public class ISPBadDemo {


    public static void main(String[] args) {
        // 麻雀
        Bird sparrow = new Sparrow();
        sparrow.run();

        // 鸵鸟
        Bird ostrich = new Ostrich();
        ostrich.fly();
    }

    /**
     * 鸟类接口
     */
    interface Bird {
        // 飞
        void fly();

        // 跑
        void run();

        // 吃
        void eat();

    }

    /**
     * 麻雀
     */
    static class Sparrow implements Bird {

        @Override
        public void fly() {
            System.out.println("I'm flying");
        }

        @Override
        public void run() {
            throw new RuntimeException("I'm cannot run");
        }

        @Override
        public void eat() {
            System.out.println("I'm eating");
        }
        
    }
	
    /**
     * 鸵鸟
     */
    static class Ostrich implements Bird {

        @Override
        public void fly() {
            throw new RuntimeException("I'm cannot flying");
        }

        @Override
        public void run() {
            System.out.println("I'm run");
        }

        @Override
        public void eat() {
            System.out.println("I'm eating");
        }
    }


}
